package mapReduce.homework.q6_orderInfoTop10;

import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.WritableComparable;
import org.apache.hadoop.io.WritableComparator;

public class GetMenuSailTop10GroupComparator extends WritableComparator {
    public GetMenuSailTop10GroupComparator(){
        super(Text.class,true);
    }
    @Override
    public int compare(WritableComparable a, WritableComparable b) {

        String aBean = a.toString();
        String bBean = b.toString();

        String[] afields = aBean.split("\t");
        String[] bfields = bBean.split("\t");

        String ayear = afields[0];
        String byear = bfields[0];


        return ayear.compareTo(byear);
    }
}
